BigDFT.wahba module

This module provides helper subroutines for performing rototranslations.

In particular, this module can solve Wahba’s problem, which seeks to compute the optimal rotation matrix between two sets of points.

https://en.wikipedia.org/wiki/Kabsch_algorithm

apply_R(R, A)[source]

Apply the rotation on the set of vectors A.

Parameters
  • R (numpy.matrix) – a rotation matrix.

  • A (numpy.matrix) – the set of vectors to rotate.

Returns

the set of vectors, rotated by the matrix.

Return type

(numpy.matrix)

apply_Rt(R, t, A)[source]

Rotate the element and apply the translation on the rotated vector.

Parameters
  • R (numpy.matrix) – a rotation matrix.

  • t (numpy.matrix) – a translation matrix.

  • A (numpy.matrix) – the set of vectors to translate.

Returns

the set of vectors, rototranslated.

Return type

(numpy.matrix)

apply_t(t, A)[source]

Apply a translation on the set of vectors A.

Parameters
  • t (numpy.matrix) – a translation matrix.

  • A (numpy.matrix) – the set of vectors to translate.

Returns

the set of vectors, translated by the matrix.

Return type

(numpy.matrix)

interpolate_points(A, B, steps, extrapolation_steps=0)[source]

Given a set of points A and B, this generates a list of point sets that interpolate between A and B in a specified number of steps.

Parameters
  • A (numpy.matrix) – an NX3 matrix of points.

  • B (numpy.matrix) – a second NX3 matrix of points.

  • steps (int) – the number of steps to take between A and B.

  • extrapolation_steps (int) – optionally, we can extrapolate a number of steps beyond B on the same trajectory.

Returns

a list of points interpolating between A and B including A and B.

Return type

(list)

rigid_transform_3D(A, B, verbose=False)[source]

Find the transformation R and t such that R*A + t ~= B, with an error quantified by J.

Parameters
  • A (numpy.matrix) – an NX3 matrix of points.

  • B (numpy.matrix) – a second NX3 matrix of points.

  • verbose (bool) – whether to be verbose during the calculation.

Returns

3x3 rotation matrix/ (numpy.matrix): 3X1 column vector representing the translation. (float): a quantification of the error.

Return type

(numpy.matrix)